package com.zzy.mccjt.retelimiter;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @program: mccjt-cloud
 * @description: 限流条件
 * @author: zhouyang.zheng
 * @create: 2022-08-01 16:48
 **/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class RateLimitCondition {

    /**
     * 自定义限流Key
     */
    private String key;

    /**
     * 每秒生产令牌数量
     */
    @Builder.Default
    private float replenishRate = 1.0F;

    /**
     * 桶容量（并发数量）
     */
    @Builder.Default
    private int burstCapacity = 10;

    /**
     * 每次请求消耗令牌数量
     */
    @Builder.Default
    private int requestedTokens = 1;
}
